<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/3/12
 * Time: 22:22
 */
class News_model extends CI_Model
{
    public function __construct()
    {
        $this->load->database();
    }

    public function get_news($slug = false)
    {
        if (false === $slug) {
            $query = $this->db->get('news');
            return $query->result_array();
        }
        $query = $this->db->get_where('news', ['slug' => $slug]);
        return $query->row_array();
    }
}